package com.ftg.learn.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ftg.learn.system.entity.Log;
import com.ftg.learn.system.service.ILogService;
import com.ftg.learn.util.JsonWeb;
import com.ftg.learn.util.JsonWebUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 日志显示功能
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/5/5 上午10:22
 */
@Api(tags = "日志功能")
@RequestMapping("/api/system/log")
@RestController
public class LogController {

    @Resource
    ILogService iLogService;

    @ApiOperation("日志列表功能")
    @GetMapping("/list")
    public JsonWeb<IPage<Log>> list(
            @ApiParam(value = "当前页数") @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
            @ApiParam(value = "每页显示条数") @RequestParam(value = "limit", defaultValue = "10") Integer limit
    ) {
        IPage<Log> ipage = new Page<>(pageNo, limit);
        return JsonWebUtil.success(iLogService.page(ipage));
    }

}
